<?php
/**
 * Update CT_RaidTracker Member Aliases
 *
 * @category Plugins
 * @package CT_RaidTrackerImport
 * @copyright (c) 2006, EQdkp <http://www.edqkp.com>
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
 * @author Garrett Hunter <loganfive@blacktower.com>
 * $Rev: 84 $ $Date: 2007-04-22 09:42:16 +0000 (Sun, 22 Apr 2007) $
 */

if ( !defined('EQDKP_INC') )
{
    die('Hacking attempt');
}

/**
 * Display a list of member aliases. Provides mass delete and single alias add.
 * @subpackage ManageCTRT
 */
class CTRT_ListAliases extends CTRT_ManageAlias
{
    var $PlayerAlias;

    function CTRT_ListAliases()
    {
        global $db, $eqdkp, $user, $tpl, $pm;
        global $SID;

        $this->setMyMode("list");
        parent::eqdkp_admin();

        $this->assoc_buttons(array(
            'form' => array(
                'name'    => '',
                'process' => 'display_form',
                'check'   => 'a_members_man'))
        );
    }

    /**
     * Display form
     */
    function display_form()
    {
        global $db, $eqdkp, $user, $tpl, $pm;
        global $SID;

        $this->createMenus();

        /**
         * Generate the list of aliases
         */
        $this->daoPlayerAlias = new CTRT_PlayerAlias;

        $playerAliases = $this->daoPlayerAlias->getAll();

        foreach ($playerAliases as $row) {
            $tpl->assign_block_vars('aliases_row', array(
                'ID'    => $row['alias_id'],
                'ROW_CLASS'     => $eqdkp->switch_row_class(),
                'NAME'  => $row['member_name'],
                'ALIAS' => $row['alias_name'],
                'U_ADD_ALIAS'   => $this->getControllerLink($this->getMyParam(),"add") . "&amp;" . URI_ID . "=".$row['alias_id'])
            );
        }

        $tpl->assign_vars(array(
            // Form vars
            'F_CONFIG' => $this->getControllerLink($this->getMyParam(),"add"),

            // Language
            'L_PLUGIN_TITLE'    => $user->lang['ctrt'],
			'L_ALIAS'			=> $user->lang['ctrt_alias'],
			'L_MEMBER'			=> $user->lang['member'],

            /**
             * Help text
             */
            'L_HELP_ALIAS'      => $user->lang['ctrt_help_alias'],
            'L_DELETE'          => $user->lang['delete'],

        ));

        $eqdkp->set_vars(array(
            'page_title'    => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['ctrt_adminmenu_title'].": ".$user->lang['ctrt_adminmenu_'.$this->getMyParam()."_".$this->getMyMode()],
            'template_path' => $pm->get_data('ctrt', 'template_path'),
            'template_file' => 'admin/listaliases.html',
            'display'       => true)
        );
    }
}
?>
